import { User } from '../entity/TT';
import { ElementRef } from '@angular/core';

export enum VideoSize {
    SMALL = "SMALL",
    MIDDLE = "MIDDLE",
    BIG = "BIG"
}

export enum VideoOwner {
    TEACHER = 'TEACHER',
    ME = 'ME',
    MATE = 'MATE',
}

export enum VideoStatus {
    NONE = 'NONE',
    UNATTACHED= 'UNATTACHED',
    ATTACHING= 'ATTACHING',
    ATTACHED= 'ATTACHED',
}

export class VideoContainer {
    owner: VideoOwner;
    ownerId: string;
    size: VideoSize;

    // uin?: string;

    participantId: string;
    audioTrack?: any;
    videoTrack?: any;
    user?: User;


    active? : boolean = false;
    isMuted? : boolean = false;

    beginTime? : number = 0;

    status?: VideoStatus = VideoStatus.NONE;
    videoStatus: VideoStatus = VideoStatus.NONE;
    audioStatus: VideoStatus = VideoStatus.NONE;

    tw: TrackWrapper;
    // tws: TrackWrapper[] = [];
    attachedTime = 0;
}


export enum VideoZonePos {
    VZ_Pos1 = "VZ_Pos1",
    VZ_Pos2 = "VZ_Pos2",
    VZ_Pos3 = "VZ_Pos3"
}

export enum VideoZoneModel {
    M_1x1 = "M_1x1",
    M_5x4 = "M_5x4",
    M_10x2 = "M_10x2"
}

export class VideoZone {
    position: VideoZonePos;
    model: VideoZoneModel;
    videos: VideoContainer[];
    elementRef: ElementRef;
}

export enum TrackType {
    video = 'video',
    audio = 'audio',
}

export class Track {
    type: TrackType;
    track: any;
}

export class TrackWrapper {
    uin: string;
    participant: string;
    index: number;
    trackMap: any;
    errors = 0;
    changed = false;

    createdTime? = 0;
    attachedTime? = 0;

    isPlayed? = 0;
    playedTime? = 0;
    needRemove? = false;
}



export enum CONNECTION_STATUS {
    DISCONNECTED,
    CONNECTIONG,
    ESTABLISHED,
    FAILED,

    CONFERENCE_JOINED,
  }
